package com.nashuju.web.service.article;

import java.util.HashMap;
import java.util.List;

import org.durcframework.core.service.CrudService;
import org.springframework.stereotype.Service;

import com.nashuju.web.dao.article.ArticleExtendDao;
import com.nashuju.web.entity.article.ArticleExtend;

@Service
public class ArticleExtendService extends CrudService<ArticleExtend, ArticleExtendDao> {

    public void delABExtByabId(int abId) {
        this.getDao().delABExtByabId(abId);
    }

    public HashMap<String, String> findABExtByabId(int abId) {
        List abExtQueryList = this.getDao().findABExtByabId(abId);

        HashMap<String, String> cellMap = new HashMap<String, String>();

        for (int i = 0; i < abExtQueryList.size(); i++) {
            ArticleExtend cae = (ArticleExtend) abExtQueryList.get(i);
            cellMap.put(cae.getCellname(), cae.getCellvalue());
        }

        return cellMap;
    }

    public ArticleExtend findABExtCheckboxByabIdAndCellname(int abId, String cellname) {
        return this.getDao().findABExtCheckboxByabIdAndCellname(abId, cellname);
    }
}
